home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
comm
/
www
/
IBrowseScripts.lha
/
ibrowsescripts
/
rexx
/
graburl.ibrx
< prev
next >
Wrap
Text File
|
1998-04-18
|
3KB
|
148 lines
/* $VER: graburl.ibrx 1.0
Made by Sören Forsberg : sorenf@hem1.passagen.se
*/
/*
fixa case oberoende i filtyps-sparning
koll om någon anger "http://" som url,eller ingen url alls
*/
OPTIONS RESULTS
OPTIONS FAILAT 15
call addlib('rexxreqtools.library',0,-30)
NL ='0a'x /* newline */
zero ='00'x /* zero */
list ='<PRE>'||NL||'<B>The following files were saved:</B>'||NL||NL
tot =20000
last =0
fonttag = "rt_font=" || 'topaz' || "/" || 8
cachepath ='IBrowse:cache'
title ='Dumpfiles by sorenf@hem1.passagen.se 1998'
tags ='rt_pubscrname=IBROWSESCREEN' /* Change here the name of the screen IBROWSE runs */
noconfig_txt ='I cannot find the config-file'||NL||'Please run Dumpfiles once First!'||NL||'I need you to locate your chache-drawer'
/* Read configuration, get new cachepath if missing or wrong */
ok=open(configfile,'ibrowse:rexx/dumpfiles.config','R')
IF ok THEN DO
cachepath=readln(configfile)
close(configfile)
END
IF ~exists(cachepath'globalcache') THEN ok=0
IF ~ok THEN DO
sel=rtezrequest(noconfig_txt,,title, tags)
exit
END
address 'IBROWSE'
'QUERY URL'
url = result
url=url||zero
IF LENGTH(url)<13 THEN DO
sel=rtezrequest('Please use a valid cache-url',,title, tags)
EXIT
END
say url
IF urllen<8 THEN EXIT
sel=2
/* Check with globalcache and save appropiate file */
local=pos('file:',url)
if local~=0 then do
len=LENGTH(url)
source=SUBSTR(url,18,len-17)
END
say source
IF local=0 THEN DO
ok=open(infile,cachepath'globalcache','R')
if ~ok then exit
input=readch(infile,tot)
Do FOREVER
IF last=0 THEN last=1
hit=POS(url,input,last) /* Find a url in cachelist */
If hit>0 then Do
last=POS(zero,input,hit)
mid=last
last=POS(zero,input,last+1)
len=last-hit
yeah=SUBSTR(input,hit,len)
check=compare(url,yeah) /* Check if we want it */
yeahupp=UPPER(yeah)
yeah=RIGHT(yeah,13)
test=pos(zero,yeah)
IF test~=0 THEN yeah=RIGHT(yeah,(LENGTH(yeah)-test))
source=cachepath||yeah
leave
END
IF hit>(tot-200) | (hit=0) THEN DO /* Take a new bit of cachelist */
old=RIGHT(input,200) /* if needed */
new=READCH(infile,tot-200)
input=old||new
last=last-(tot-200)
IF last<1 THEN last=1
END
IF EOF(infile) | (hit~=0) THEN LEAVE /* Are we done yet? */
END
ADDRESS 'AREXX'
close(infile)
END
list='<BIG>Non-linked possible URL''s<BIG><PRE>'||NL
ok=open(configfile,source,'R')
say ok
say source
dup_chars='.,!?"*%&)' /* ta bort före och efter */
IF ok THEN DO
DO UNTIL EOF(configfile)
line=readln(configfile)
DO i=1 TO WORDS(line)
check=WORD(line,i)
check=STRIP(check,'B','.')
dot=pos('.',check)
IF dot~=0 THEN DO
dot1=pos('.',check,dot+1)
IF (dot1~=0) & ((dot+1)~=dot1) & (pos('=',check)=0) THEN DO
check=STRIP(check,'B','"')
list=list||'<A HREF="'||check||'">'||check||'</A>'||NL
END
END
END
END
close(configfile)
say list
/*Save the list of files and send to IBrowse*/
list=list||'</PRE>'
ok=open(resultfile,'RAM:T/graburl.html','W')
new=writeln(resultfile,list)
close(resultfile)
address 'IBROWSE' 'GOTOURL file://localhost/RAM:T/graburl.html'
END
Exit
/*
mailto om inneh @
strippa alla dup tecken tills ok, ska göras före punktcheck
slopa kopiering till ram: läs direkt.
koll om html
göra en loop till check för att få antal punkter
om html kolla att det inte finns en '<A HREF=' före '</A>' ,
kräver att vi har en UPPER(line) att testa mot?
läsa in och lägga ihop flera rader för att kunna kolla ovanstående
*/